<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


function smarty_function_sprintf($params, &$smarty)
{

	$assign = NULL;
	$args   = "";

	foreach( $params as $_key => $_parameter ) {

		if( $_key == "var" ) {

			$assign = $_parameter;

		} else {

			$args[] = $_parameter;

		}

	}

	if( !is_null($assign) ) {

		$smarty->assign($assign, call_user_func_array("sprintf", $args));

	} else {

		call_user_func_array("printf", $args);

	}	# if

}

/* vim: set expandtab: */

?>
